package com.ap.core.domain;


import com.ap.core.cxf.jaxb.common.ActivationStatus;
import org.hibernate.annotations.Type;
import org.hibernate.annotations.TypeDef;
import org.joda.time.LocalDateTime;

import javax.persistence.*;

/**
 * User: Ranjit.Singh
 */
@Entity
@Table(name = "T_ZAPP_USER")
@AttributeOverride(name = "id",column = @Column(name = "ZAPP_ID"))
@TypeDef(name = "id", typeClass = Long.class)
public class ZappUser extends Identifiable<Long> {

	private static final long serialVersionUID = -748237489327489L;

	@Column(name = "ZAPP_EMAIL_ID")
    private String zappEmailId;

    @Column(name = "ZAPP_MOBILE_NUMBER")
    private String zappMobileNumber;

    @Column(name = "status_code")
    @Enumerated(EnumType.STRING)
    private ActivationStatus statusCode;

    @Column(name = "email_verification_flag")
    private Boolean emailVerificationFlag;

    @Column(name = "email_verification_tmstmp")
    @Type(type = "org.jadira.usertype.dateandtime.joda.PersistentLocalDateTime")
    private LocalDateTime emailVerificationTmstmp;



    private ZappUser(){}

    public ZappUser(String zappEmailId, String zappMobileNumber) {
        this.statusCode = ActivationStatus.ACTIVE;
        this.emailVerificationFlag = Boolean.FALSE;
        this.zappEmailId = zappEmailId;
        this.zappMobileNumber = zappMobileNumber;
    }

    public void setEmailVerificationFlag(Boolean emailVerificationFlag) {
        this.emailVerificationFlag = emailVerificationFlag;
    }

    public void setEmailVerificationTmstmp(LocalDateTime emailVerificationTmstmp) {
        this.emailVerificationTmstmp = emailVerificationTmstmp;
    }

    public String getZappEmailId() {
        return zappEmailId;
    }

    public String getZappMobileNumber() {
        return zappMobileNumber;
    }

    public Boolean getEmailVerificationFlag() {
        return emailVerificationFlag;
    }

    public LocalDateTime getEmailVerificationTmstmp() {
        return emailVerificationTmstmp;
    }

    public ActivationStatus getStatusCode() {
        return statusCode;
    }
}
